package com.poem.springboot_rear;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

@SpringBootApplication
@Slf4j
public class SpringbootRearApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext applicationContext = SpringApplication.run(SpringbootRearApplication.class, args);
		log.info(".......................................................................................\n" +
				"#############.........#######..................##.......######........#######............\n" +
				"..........###........##........##..............##.....##.......##....##......##..........\n" +
				"........###.........##.........................##.....##..........##..........##.........\n" +
				"......###...............####...................##......##....................##..........\n" +
				"....###......................##......##........##........##...............##.............\n" +
				".###................##.......##......##.......##............##.........##................\n" +
				"##############........########..........#####....................###.....................\n" +
				".........................................................................................");


		Environment env = applicationContext.getEnvironment();
		String port = env.getProperty("server.port");
		String property = env.getProperty("server.servlet.context-path");
		String path = property == null ? "" :  property;
		System.out.println(
				"\n\t" +
						"----------------------------------------------------------\n\t" +
						"Application Sailrui-Boot is running! Access URLs:\n\t" +
						"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
						"swagger: \thttp://localhost:" + port + path + "/"+"doc.html\n\t" +
						"------------------------------------------------------------");
	}

}
